<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="urunSearch" styleClass="edit">

        <rich:simpleTogglePanel label="Urun Search Filter" switchType="ajax" opened="false">

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Adi</ui:define>
                <h:inputText id="adi" value="#{urunList.urun.adi}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Ambalaj</ui:define>
                <h:inputText id="ambalaj" value="#{urunList.urun.ambalaj}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Barkod</ui:define>
                <h:inputText id="barkod" value="#{urunList.urun.barkod}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Paletadedi</ui:define>
                <h:inputText id="paletadedi" value="#{urunList.urun.paletadedi}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Upc</ui:define>
                <h:inputText id="upc" value="#{urunList.urun.upc}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Urunno</ui:define>
                <h:inputText id="urunno" value="#{urunList.urun.urunno}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Match</ui:define>
                <h:selectOneRadio id="logic" value="#{urunList.restrictionLogicOperator}" styleClass="radio">
                    <f:selectItem itemLabel="All" itemValue="and"/>
                    <f:selectItem itemLabel="Any" itemValue="or"/>
                </h:selectOneRadio>
            </s:decorate>

        </rich:simpleTogglePanel>

        <div class="actionButtons">
            <h:commandButton id="search" value="Search" action="/UrunList.xhtml"/>
            <s:button id="reset" value="Reset" includePageParams="false"/>
        </div>

    </h:form>

    <rich:panel>
        <f:facet name="header">Urun Search Results (#{empty urunList.resultList ? 0 : (urunList.paginated ? urunList.resultCount : urunList.resultList.size)})</f:facet>
    <div class="results" id="urunList">

    <h:outputText value="The urun search returned no results."
               rendered="#{empty urunList.resultList}"/>

    <rich:dataTable id="urunList"
                var="_urun"
              value="#{urunList.resultList}"
           rendered="#{not empty urunList.resultList}">
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{urunList}"/>
                    <ui:param name="propertyLabel" value="Id"/>
                    <ui:param name="propertyPath" value="urun.id"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_urun.id}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{urunList}"/>
                    <ui:param name="propertyLabel" value="Urunno"/>
                    <ui:param name="propertyPath" value="urun.urunno"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_urun.urunno}"/>
        </h:column>        
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{urunList}"/>
                    <ui:param name="propertyLabel" value="Adi"/>
                    <ui:param name="propertyPath" value="urun.adi"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_urun.adi}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{urunList}"/>
                    <ui:param name="propertyLabel" value="Kalip"/>
                    <ui:param name="propertyPath" value="urun.kalip.id"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_urun.kalip.kod} - #{_urun.kalip.ad}"/>
        </h:column>        
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{urunList}"/>
                    <ui:param name="propertyLabel" value="Ambalaj"/>
                    <ui:param name="propertyPath" value="urun.ambalaj"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_urun.ambalaj}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{urunList}"/>
                    <ui:param name="propertyLabel" value="Barkod"/>
                    <ui:param name="propertyPath" value="urun.barkod"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_urun.barkod}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{urunList}"/>
                    <ui:param name="propertyLabel" value="Upc"/>
                    <ui:param name="propertyPath" value="urun.upc"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_urun.upc}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{urunList}"/>
                    <ui:param name="propertyLabel" value="Paletadedi"/>
                    <ui:param name="propertyPath" value="urun.paletadedi"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_urun.paletadedi}"/>
        </h:column>
        <rich:column styleClass="action">
            <f:facet name="header">Action</f:facet>
            <s:link view="/#{empty from ? 'Urun' : from}.xhtml"
                   value="#{empty from ? 'View' : 'Select'}"
             propagation="#{empty from ? 'none' : 'default'}"
                      id="urunViewId">
                <f:param name="urunId"
                        value="#{_urun.id}"/>
            </s:link>
            #{' '}
            <s:link view="/UrunEdit.xhtml"
                   value="Edit"
             propagation="none"
                      id="urunEdit"
                rendered="#{empty from}">
                <f:param name="urunId"
                        value="#{_urun.id}"/>
            </s:link>
        </rich:column>
    </rich:dataTable>

    </div>
    </rich:panel>

    <div class="tableControl">

        <s:link view="/UrunList.xhtml"
            rendered="#{urunList.previousExists}"
               value="#{messages.left}#{messages.left} First Page"
                  id="firstPage">
          <f:param name="firstResult" value="0"/>
        </s:link>

        <s:link view="/UrunList.xhtml"
            rendered="#{urunList.previousExists}"
               value="#{messages.left} Previous Page"
                  id="previousPage">
            <f:param name="firstResult"
                    value="#{urunList.previousFirstResult}"/>
        </s:link>

        <s:link view="/UrunList.xhtml"
            rendered="#{urunList.nextExists}"
               value="Next Page #{messages.right}"
                  id="nextPage">
            <f:param name="firstResult"
                    value="#{urunList.nextFirstResult}"/>
        </s:link>

        <s:link view="/UrunList.xhtml"
            rendered="#{urunList.nextExists}"
               value="Last Page #{messages.right}#{messages.right}"
                  id="lastPage">
            <f:param name="firstResult"
                    value="#{urunList.lastFirstResult}"/>
        </s:link>

    </div>

    <s:div styleClass="actionButtons" rendered="#{empty from}">
        <s:button view="/UrunEdit.xhtml"
                    id="create"
           propagation="none"
                 value="Create urun">
            <f:param name="urunId"/>
        </s:button>
    </s:div>

</ui:define>

</ui:composition>
